<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="format-detection" content="telephone=no">
		<link rel="stylesheet" href="../layui/css/layui.css" media="all" />
		<link rel="stylesheet" href="../css/public.css" media="all" />
		<style>
			.importFile {
				position: relative;
				padding: 10px;
				padding-left: 70px;
			}
			
			.importFile .label {
				position: absolute;
				top: 13px;
				left: 10px;
			}
			
			.importFile li {
				line-height: 25px;
			}
			
			.importFile li:last-child {
				margin-top: 20px;
			}
			
			.importFile li b {
				margin-right: 10px;
			}
		</style>
	</head>

	<body class="childrenBody">
		<div class="importFile">
			<span class="label">说明：</span>
			<ul>
				<li>1、下载标准EXCEL模板</li>
				<li>2、将所需导入信息填写入标准EXCEL模板，请不要随意变更模板文件中单元格的样式，例如合并单元格，随意增删列等</li>
				<li>3、选择填写好的标准格式的EXCEL文件，将填写信息批量导入系统。</li>
				<li><b>导入通用模板数据</b>
					<button type="button" class="layui-btn layui-btn-normal file" style="margin-right: 5px;">选择文件</button>
					<button type="button" class="layui-btn layui-btn-normal down">下载标准模板</button>
				</li>
				
				<li style="margin-top: 20px;"><b>导入危险物料数据</b>
					<button type="button" class="layui-btn layui-btn-normal file2" style="margin-right: 5px;">选择文件</button>
					<button type="button" class="layui-btn layui-btn-normal down2">下载标准模板</button>
				</li>
				<li><b>导入环境因素数据</b>
					<button type="button" class="layui-btn layui-btn-normal file3" style="margin-right: 5px;">选择文件</button>
					<button type="button" class="layui-btn layui-btn-normal down3">下载标准模板</button>
				</li>
			</ul>
		</div>
		<script type="text/javascript" src="../layui/layui.js"></script>
		<script type="text/javascript" src="common/jquery.min.js"></script>
		<script type="text/javascript" src="common/config.js"></script>
		<script>
			var uploadUrl = getQueryVariable('url');
			$(".down").click(function() {
				location.href = "../images/" + uploadUrl + ".xls"
			});
			$(".down2").click(function() {
				location.href = "../images/" + uploadUrl + "2.xls"
			});
			$(".down3").click(function() {
				location.href = "../images/" + uploadUrl + "3.xls"
			});
			var salt = sessionStorage.getItem('usersalt');
			var load;
			layui.use('upload', function() {
				var $ = layui.jquery,
					upload = layui.upload;
				upload.render({
					elem: '.file',
					url: url + "attachment/upload",
					multiple: true,
					exts: 'xlsx|xls',
					before: function(obj) {

					},
					done: function(res, index) {
						var id = res.data.id;
						//上传完毕
						if(res.code == 0) {
							$.post(url + uploadUrl + "/importFile", {
								id: id,
								Token: salt
							}, function(data) {
								layer.confirm('上传成功', {
									title: '提示信息'
								}, function(index) {
									layer.close(index);
								});
							})
						}
					}
				});
				upload.render({
					elem: '.file2',
					url: url + "attachment/upload",
					multiple: true,
					exts: 'xlsx|xls',
					before: function(obj) {

					},
					done: function(res, index) {
						var id = res.data.id;
						//上传完毕
						if(res.code == 0) {
							$.post(url + uploadUrl + "/importFile2", {
								id: id,
								Token: salt
							}, function(data) {
								layer.confirm('上传成功', {
									title: '提示信息'
								}, function(index) {
									layer.close(index);
								});
							})
						}
					}
				});
				upload.render({
					elem: '.file3',
					url: url + "attachment/upload",
					multiple: true,
					exts: 'xlsx|xls',
					before: function(obj) {

					},
					done: function(res, index) {
						var id = res.data.id;
						//上传完毕
						if(res.code == 0) {
							$.post(url + uploadUrl + "/importFile3", {
								id: id,
								Token: salt
							}, function(data) {
								layer.confirm('上传成功', {
									title: '提示信息'
								}, function(index) {
									layer.close(index);
								});
							})
						}
					}
				});

			});
		</script>
	</body>

</html>